@isTest(SeeAllData=true)
private class CaseSmsHandlerTest {
    static testMethod void testMethod1() {
        TestUtils.createUsers();

        User engineer = [SELECT Id, Name FROM User WHERE Name = '用户3'];

        Account acc = TestUtils.createAccount();
        acc.name = 'CaseSmsHandlerTest';
        insert acc;

        Contact con = TestUtils.createContact();
        con.AccountId = acc.Id;
        con.MobilePhone = '17811112222';
        insert con;

        Product__c pro1 = TestUtils.createInst();
        insert pro1;

        Case c1 = new Case();
        c1.AccountId = acc.Id;
        c1.ContactId = con.Id;
        c1.Engineer__c = engineer.Id;
        c1.Manufacturer__c = pro1.Id;
        c1.User__c = engineer.Id;
        c1.Professional__c = engineer.Id;
        //c1.CaseNumber = '0000000012';
        
        Case c2 = new Case();
        c2.AccountId = acc.Id;
        c2.ContactId = con.Id;
        c2.Engineer__c = engineer.Id;
        c2.Manufacturer__c = pro1.Id;
        
        
        
        Case c3 = new Case();
        c3.AccountId = acc.Id;
        c3.ContactId = con.Id;
        c3.Engineer__c = engineer.Id;
        c3.Manufacturer__c = pro1.Id;
        c3.User__c = engineer.Id;
        c3.TelDealComplete__c = true;
        insert new Case[] {c1, c2,c3};

        c1.Status = '已分配';
        c1.SendSatisfySms__c = true;
        update c1;

        c1.Status = '完成';
        c1.TelDealComplete__c = true;
        update c1;

        WorkOrder__c wo1 = new WorkOrder__c();
        wo1.Case__c = c2.Id;
        WorkOrder__c wo2 = new WorkOrder__c();
        wo2.Case__c = c2.Id;
        insert new WorkOrder__c[] {wo1, wo2};

        c2.Status = '完成';
        update c2;
    }
}